package controleur;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import model.GestionAddress;
import view.ContactForm;
import view.PrincipalWindow;
import view.SearchForm;

public class ActionEdit implements ActionListener{

	
	private SearchForm search;
	public static ArrayList<String> cont1;
	
	public ActionEdit(SearchForm search){
		this.search = search;
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
		if (e.getSource() == search.getJButtonValidate()) {

			GestionAddress gA = new GestionAddress();
			cont1 = gA.editContact(MainControleur.data, search.getJTextFieldFname().getText(), search.getJTextFieldLname().getText(),
            		search.getJTextFieldEmailPers().getText());
			
			SearchForm.jframe1.setVisible(false);
			ContactForm.jframe1.setVisible(true);
			//MainControleur.fen.setVisible(true);
			MainControleur.fen.contactInfo(MainControleur.data);
			MainControleur.fen.remove(PrincipalWindow.jLabel1);
			PrincipalWindow.jLabel1.setIcon(new javax.swing.ImageIcon("fondframe.jpg")); // NOI18N
			PrincipalWindow.jLabel1.setText("jLabel1");
	        MainControleur.fen.getContentPane().add(PrincipalWindow.jLabel1);
	        PrincipalWindow.jLabel1.setBounds(0, 0, 950, 665);
        }
		
	}
}
